/*  This file is part of Basepairs, an application for calculations on
    DNA Sequence polymorphism.
    Copyright (C) 2013 Kim Lindgren

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.*/


package basepairs;

public class MainClass {
    public static void main(String[] args) {               
        String file = "abi3-aligned.fas";
        //String file = "dam3-aligned.fas";
        //String file = "dreb-aligned.fas";
        
        loadFile.readFile(file);
        
        //ABI3
        Sequences.defineCodingRegion(1, 1734);
        Sequences.defineCodingRegion(1820, 1912);
        Sequences.defineCodingRegion(2007, 2107);
        Sequences.defineCodingRegion(2333, 2379);
        Sequences.defineCodingRegion(2546, 2622);
        Sequences.defineCodingRegion(2757, 2787);
        
        //DAM3
        //Sequences.defineCodingRegion(2, 66);
        //Sequences.defineCodingRegion(138, 237);
        //Sequences.defineCodingRegion(358, 399);
        //Sequences.defineCodingRegion(924, 965);
        //Sequences.defineCodingRegion(1104, 1259);
        
        //DREB
        //Sequences.defineCodingRegion(213, 806);
        
        Sequences.firstExonOffset = 0;
        Sequences.selectWholeSequences();
              
        NucleotideDiversity ND = new NucleotideDiversity();
        Watterson Watt = new Watterson();
        
        ND.calcAvgPairwiseDiff();
        Watt.calcSegregatingSites();
        System.out.println("Average number of nucleotide differences, pi: " + ND.pi);
        System.out.println("Wattersons estimator (Theta per site): " + Watt.Theta);
        
        Sequences.selectCoding();
        
        Watt.calcSegregatingCodons(0);
        
        System.out.println("Wattersons estimator, non-synonymous sites: " + Watt.nonSynTheta);
        System.out.println("Wattersons estimator, synonymous sites: " + Watt.synTheta);
    }
}